package com.redstars.generate.handle;

import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import org.apache.ibatis.reflection.MetaObject;
import java.util.Date;

/**
 * mybatis-plus 自动填充字段
 *
 * @author zhouhx
 */
public class FieldMetaObjectHandler implements MetaObjectHandler {
    private final static String CREATE_TIME = "createTime";

    @Override
    public void insertFill(MetaObject metaObject) {
        Date date = new Date();

        // 创建时间
        strictInsertFill(metaObject, CREATE_TIME, Date.class, date);
    }

    @Override
    public void updateFill(MetaObject metaObject) {

    }
}